<?php
/**
 * Author: Traveler
 * Time  : 2021/8/31 16:33
 */

namespace app\controller\crm\v1;


use app\ErrorCode;
use app\service\LoginService;
use sunshine\basic\BaseController;
use think\App;
use think\Response;

class Login extends BaseController
{
    /**
     * Login constructor.
     *
     * @param App         $app
     * @param LoginService $service
     */
    public function __construct(App $app, LoginService $service)
    {
        parent::__construct($app);
        $this->service = $service;
    }

    /**
     * 账号登录
     *
     * @return Response
     */
    public function account(): Response
    {
        $account = $this->request->post();

        $data = $this->service->account($account);

        return $this->json->api(ErrorCode::SUCCESS, $data);
    }
}
